#include <stdio.h>
#include "util_mem.h"

#define HEAP_1_SIZE 16384

static uint8_t heap1[HEAP_1_SIZE];

int main(int argc, char *argv[])
{
    uint8_t * (point_array[3]);

    printf("------------ Create heap ------------\n");
    UtilMemCreate(heap1, HEAP_1_SIZE, "heap1");

    printf("------------ 1st malloc ------------\n");
    point_array[0] = (uint8_t *)UtilMemMalloc("heap1", 100);

    printf("------------ 2nd malloc ------------\n");
    point_array[1] = (uint8_t *)UtilMemMalloc("heap1", 200);

    printf("------------ 3rd malloc ------------\n");
    point_array[2] = (uint8_t *)UtilMemMalloc("heap1", 300);

    printf("------------ Free point_array[1] ------------\n");
    UtilMemFree("heap1", point_array[1]);

    printf("------------ Free point_array[2] ------------\n");
    UtilMemFree("heap1", point_array[2]);

    (void)point_array;
    
    return 0;
}
